#include <iostream>
#include <vector>
/**
 * @brief 自己编写的答案
 * 
 * @return int 
 */
void main1()
{
    std::vector<int> v1{0, 1, 2, 3, 4, 5, 6};
    int i = 3;
    auto begin = v1.begin();
    auto end = v1.end();

    while(begin != end)
    {
        if(i == *begin)
        {
            std::cout << "i in v" << std::endl;
            break;
            
        }
        else
        {
            begin++;
        }
    }
}

/**
 * @brief 参考答案
 * 
 */
bool serch_vec(std::vector<int>::iterator beg, std::vector<int>::iterator end, int val)
{
    for( ; beg != end; beg++)
    {
        if(*beg == val)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    std::vector<int> ilist = {1, 2, 3, 4, 5, 6, 7, 8};
    std::cout << serch_vec(ilist.begin(), ilist.end(), 3) << std::endl;
}